<template>
        <section class="gg">
          <img src="@/assets/images/公告.png">
          <p class="gg_p">公告：</p>
<div class="marquee">

  
        <div class="marquee_box">
                <ul class="marquee_list" :class="{marquee_top:animate}">
                        <li v-for="(item,index) in marqueeList" :key="index">{{item.title}}</li>
                </ul>
        </div>
</div>




        </section>
  
</template>

<script>
export default {
  data() {
    return {
      animate: false,

      marqueeList: []
    };
  },
  created: function() {
    // 页面显示
       this.$http.get("/api/portal/notice/getNoticeList").then((d)=>{
       this.marqueeList=d.data.data
       console.log(this.marqueeList)   
   }).catch((err)=>{
     console.log(err)
   })
    setInterval(this.showMarquee, 2000);
  },
  methods: {
    showMarquee: function() {
      this.animate = true;

      setTimeout(() => {
        this.marqueeList.push(this.marqueeList[0]);

        this.marqueeList.shift();

        this.animate = false;
      }, 500);
    },
}
}

</script>

<style scoped>

.marquee {
  width: 70%;
  height: 0.3rem;
  align-items: center;
  color: #3a3a3a;
  float:left;
overflow: hidden;
display: relative;
}


.marquee_box {
  display: block;
  position: absolute;
  width: 60%;
  height: 0.5172413793103449rem;
  overflow: hidden;
  z-index:99;
}

.marquee_list {
  display: block;

  position: absolute;

  top: 0;

  left: 0;
}

.marquee_top {
  transition: all 0.5s;
  margin-top: -30px;
}

.marquee_list li {
  height: 0.5172413793103449rem;

  line-height: 0.5172413793103449rem;

  font-size: 0.2rem;
}

.marquee_list li span {
  padding: 0 2px;
}
 .gg {
     width: 90%;
     height: 0.5172413793103449rem;
     margin-top: 0.2rem;
     background: white;
     border-radius: 0.43103448275862066rem;
     margin: 0.1rem auto;
     display: relative;
}
 .gg img {
   float: left;
     height: 60%;
     margin-top: 0.1rem;
     margin-left: 0.3rem;
}
 .gg_p {
     display: inline-block;
     height: 100%;
     margin-left: 0.08620689655172414rem;
    vertical-align: top;
    line-height: 0.5172413793103449rem;
    float: left;
    font-size: 0.2rem;
}
</style>